/**
 * <p>Copyright:Copyright(c) 2019</p>
 * <p>Company:Professional</p>
 * <p>Package:org.cesgroup.course.sample</p>
 * <p>File:DirectHandler.java</p>
 * <p>类更新历史信息</p>
 * @todo chanlong(陈龙) 创建于 Sep 16, 2019 11:50:00 AM
 */
package org.cesgroup.course.sample.hype;

import org.cesgroup.course.interceptor.Interceptor;
import org.cesgroup.course.interceptor.Invocation;
import org.cesgroup.course.interceptor.annon.Intercepts;
import org.cesgroup.course.interceptor.annon.Signature;
import org.springframework.core.annotation.Order;

/**
 * <p>描述: </p>
 * <p>Company: Professional</p>
 * @author chanlong(陈龙)
 * @date Sep 16, 2019 11:50:00 AM
 * @version 1.0.2019
 */
@Order(0)
@Intercepts({@Signature(type = Handler.class, method = "handle", args = {Integer.class})})
public class SkipHandler implements Interceptor {

	@Override
	public Object intercept(Invocation invocation) throws Throwable {
		Object[] args = invocation.getArgs();
		int days = (int)args[0];
		
		if (days == 1) {
			System.out.println("处理跳过审批的逻辑");
			return null;
		} 
		
		Handler handler = (Handler) invocation.getTarget();
		return handler.handle((int)args[0]);
	}
}
